import * as React from 'react';
import {Datagrid,Datagrid_t} from "@/components/datagrid";
import {Form} from "@/components/form";
import {serverFetch} from "@/components/server-fetch";


export default async function Page() {
    const dataOuter = await serverFetch("outerDetail")
    const dataDetail = await serverFetch("materialDetailMaintenance")
    const detailJson = {
        materialDetailMaintenanceId: {name: '物料明细编号', type: 'number'},
        receiveMaterialId: {name: '领料单号', type: 'number'},
        materialId: {name: '物料编号', type: 'number'},
        materialName: {name: '物料名称', type: 'string'},
        specification: {name: '规格', type: 'string'},
        managementType: {name: '管理类别', type: 'string'},
        storehouseName: {name: '仓库名称', type: 'string'},
        purchaseCode: {name: '采购单号', type: 'string'},
        status: {name: '状态', type: 'string'},
    }
    const detailJson2 = {
        storehouseName: {name: '仓库名称', type: 'string'},
        materialDetailMaintenanceId: {name: '领料单号', type: 'number'},
    }
    const outerJson = {
        outerDetailId: {name: '外部单号', type: 'number'},
        LPN: {name: 'LPN', type: 'string'},
        totalQuantity: {name: '总数量', type: 'number'},
        source: {name: '来源', type: 'string'},
        status: {name: '状态', type: 'string'},
        remark: {name: '备注', type: 'string'},
    }
    const outerJson2 = {
        LPN: {name: 'LPN', type: 'string'},
    }
    return (
        <main className='px-5'>
            <p className="text-3xl py-5">
                # 收料
            </p>
            <Datagrid_t rows={dataDetail.data} keyword={'materialDetailMaintenanceId'} list={detailJson} list2={detailJson2} type={"materialDetailMaintenance"}/>
            <Datagrid_t rows={dataOuter.data} keyword={'outerDetailId'} list={outerJson} list2={outerJson2} type={"outerDetail"}/>
            {/* <Form list={dataJson} type={api_type}/> */}
        </main>
    )
}
